﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EOS.Framework.Contracts.Data
{
    /// <summary>
    /// This is just a marker interface to find all dao classes.
    /// </summary>
    public interface IBaseDao
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseDao<TEntity> : IBaseDao
    {
        /// <summary>
        /// Gets the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        TEntity Get(int id);

        /// <summary>
        /// Finds all.
        /// </summary>
        /// <returns></returns>
        IList<TEntity> FindAll();

        IList<TEntity> Find(int firstResult, int limit);


        /// <summary>
        /// Count all entries.
        /// </summary>
        /// <returns>Number of entries.</returns>
        int Count();

        /// <summary>
        /// Saves the or update.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void SaveOrUpdate(TEntity entity);

        /// <summary>
        /// Saves the or update.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void SaveOrUpdate(TEntity entity, bool commit);

        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Delete(TEntity entity);
    }
}
